/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SECURE_ELEMENT_COMMON_H
#define SECURE_ELEMENT_COMMON_H
#include "cj_common_ffi.h"
#include "common_utils.h"
#include "native/ffi_remote_data.h"
#include "secure_element_ffi.h"
#include "se_service.h"
#include "session.h"

namespace OHOS {
namespace SE {
namespace OMAPI {
const int32_t CJ_INPUT_INVALID_ERR = 401;
const int32_t CJ_UNSUPPORTED_ERR = 801;
const int32_t CJ_ILLEGAL_STATE_ERR = 3300101;
const int32_t CJ_ILLEGAL_ELEMENT_ERR = 3300102;
const int32_t CJ_SECURITY_ERR = 3300103;
const int32_t CJ_IO_ERR = 3300104;
const uint32_t CJ_INVALID_RETURN_VALUE = 0;
const int32_t CJ_INVALID_VALUE = -1;
const int64_t CJ_INVALID_VALUE_64 = -1;
const int32_t NATIVE_SUCCESS = 0;
const size_t MAX_MEM_MALLOC_SIZE = 128;
enum ServiceState {
    /** service disconnected */
    DISCONNECTED = 0,

    /** service connected */
    CONNECTED = 1,
};

int32_t Convert2CJErrorCode(ErrorCode errcode);

CArrI32 ConvertString2Arr(std::string atr);

std::string ConvertArr2String(CArrI32 aid);

char *MallocCString(const std::string &origin);

int32_t IsSupportOpenBasicChannel(std::weak_ptr<Session> session);
}  // namespace OMAPI
}  // namespace SE
}  // namespace OHOS
#endif
